//
//  DSYSongModel.m
//  BLDMusic
//
//  Created by dllo on 16/3/17.
//  Copyright © 2016年 白云杰. All rights reserved.
//

#import "DSYSongModel.h"
#import "DSYSinger.h"
#import "DSYUrlModel.h"
#import "DSYMVModel.h"

@implementation DSYSongModel

- (void)setValue:(id)value forKey:(NSString *)key
{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"mvList"]) {
        self.mvList = [DSYMVModel modelHandleWithArray:value];
    }
//    if ([key isEqualToString:@"llList"]) {
//        self.llList = [DSYUrlModel modelHandleWithArray:value];
//    }
    if ([key isEqualToString:@"urlList"]) {
        self.urlList = [DSYUrlModel modelHandleWithArray:value];
    }
    if ([key isEqualToString:@"auditionList"]) {
        self.auditionList = [DSYUrlModel modelHandleWithArray:value];
    }
    
//    if ([key isEqualToString:@"songers"]) {
//        self.singers = [DSYSinger modelHandleWithArray:value];
//    }
    
    if ([key isEqualToString:@"rightKey"]) {
        self.rightKey = [NSMutableArray arrayWithArray:value[@"songRights"]];
    }
    
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}


- (id)valueForUndefinedKey:(NSString *)key
{
    return nil;
}



#pragma mark - 归档
- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.isExclusive forKey:@"isExclusive"];
    [aCoder encodeObject:self.composeId forKey:@"composeId"];
    [aCoder encodeObject:self.mvList forKey:@"mvList"];
    [aCoder encodeObject:self.listenCount forKey:@"listenCount"];
    [aCoder encodeObject:self.auditionList forKey:@"auditionList"];
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeObject:self.albumName forKey:@"albumName"];
    [aCoder encodeObject:self.picUrl forKey:@"picUrl"];
    [aCoder encodeObject:self.favorites forKey:@"favorites"];
    [aCoder encodeObject:self.singerName forKey:@"singerName"];
    [aCoder encodeObject:self.rightKey forKey:@"rightKey"];
    [aCoder encodeObject:self.filename forKey:@"filename"];
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self) {
        self.isExclusive = [aDecoder decodeObjectForKey:@"isExclusive"];
        self.composeId = [aDecoder decodeObjectForKey:@"composeId"];
        self.mvList = [aDecoder decodeObjectForKey:@"mvList"];
        self.listenCount = [aDecoder decodeObjectForKey:@"listenCount"];
        self.auditionList = [aDecoder decodeObjectForKey:@"auditionList"];
        self.name = [aDecoder decodeObjectForKey:@"name"];
        self.albumName = [aDecoder decodeObjectForKey:@"albumName"];
        self.picUrl = [aDecoder decodeObjectForKey:@"picUrl"];
        self.favorites = [aDecoder decodeObjectForKey:@"favorites"];
        self.singerName = [aDecoder decodeObjectForKey:@"singerName"];
        self.rightKey = [aDecoder decodeObjectForKey:@"rightKey"];
        self.filename = [aDecoder decodeObjectForKey:@"filename"];
    }
    return self;
}

@end
